import React, { useContext, useState } from 'react'
import { ThemeContext } from '../../context/ctext'
import useThrottle from '../../Hook/useThrottle'

function Home() {
  const tem = useContext(ThemeContext); 

   const [clickCount, setClickCount] = useState(0);

  // 定义点击按钮时的处理函数
  const handleClick = () => {
    setClickCount(prevCount => prevCount + 1);
    console.log('Button clicked!', clickCount);
  };

  // 使用 useThrottle 对 handleClick 进行节流，设定节流延迟为 1000ms（1秒）
  const throttledClick = useThrottle(handleClick, 1000);
//   useThrottle(tojl,1000)
//  console.log(debouncedValue);
// const da = useThrottle(tojl,1000)
// console.log(da);

 
  return (
    <div>
        {tem}
      456
      <button onClick={throttledClick}>点击</button>
    </div>
  )
}

export default Home
